/**
 * 
 */
package org.seckill.socket.config;

import org.seckill.socket.handler.MyTextHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor;

/**
 * websocket配置
 * @author yue
 * 2016年7月3日 下午9:05:46
 */
@Configuration	
@EnableWebSocket
public class MyWebSocketConfig implements WebSocketConfigurer {

	/* 
	 * @param websockethandlerregistry 
	 */
	@Override
	public void registerWebSocketHandlers(
			WebSocketHandlerRegistry websockethandlerregistry) {
		// 注册 WebSocket 处理类与url映射
		websockethandlerregistry.addHandler(new MyTextHandler(), "/myHandler")
		.addInterceptors(new HttpSessionHandshakeInterceptor());

	}
	
	


}
